using UnityEngine;
using UnityEngine.UI;

public class ImageBrowser : MonoBehaviour
{
    public Texture[] images; 
    private int currentIndex = 0; 

    private RawImage imageDisplay;

    void Start()
    {
        imageDisplay = GetComponentInChildren<RawImage>();
        ShowImage();
    }

    public void ShowPreviousImage()
    {
        currentIndex--;
        if (currentIndex < 0)
        {
            currentIndex = images.Length - 1;
        }
        ShowImage();
    }

    public void ShowNextImage()
    {
        currentIndex++;
        if (currentIndex >= images.Length)
        {
            currentIndex = 0;
        }
        ShowImage();
    }

    private void ShowImage()
    {
        imageDisplay.texture = images[currentIndex];
    }
}
